AudioPlayer2

NCTAudioStudio2 ActiveX DLLs
NCTAudioPlayer2 ActiveX DLL

Version 2.2

NCTAudioPlayer2 ActiveX DLL is intended for playback of audio data.

With NCTAudioPlayer2 ActiveX DLL you can:

  • Playback audio data.

  • Set playback devices .

  • Change Volume of playback.

  • Get information about playback in real time.

NCTAudioPlayer2 is a part of the NCTAudioStudio2 package.

Send Feedback on the NCTAudioPlayer2 documentation.
 NCTAudioPlayer2 was developed by NCT Company Ltd. http://www.nctsoft.com


AudioPlayer2 properties

AudioPlayer2 properties

Property | Type | Default | Description
ArrayChannels | ChannelsConstants |  | Read-only property that returns the number of channels in the audio data. Monaural data uses one channel and stereo data uses two channels.
ArrayFrequency | FrequencyConstants |  | Read-only property that returns a frequency of the audio data.
CurrentStereoChannel | CurrentChannelsConstants |  | Gets or sets the current status of stereo.
devOutput | Integer |  | Gets or sets the number of the current output device.
devOutputCount | Integer |  | Read-only property that returns the maximal number of the output devices in your system.
devOutputName | String |  | Read-only property that returns the name of the current output device. The current output device must be set by devOutput property preliminary.
devSrcEnabled | Boolean |  | Read-only property that returns a flag indicating if the current output device can be used for playback of audio data. The current output device must be set by devOutput property preliminary.
devVolume | Long |  | Gets or sets Volume for the current output device. The current output device must be set by devOutput property preliminary.
EqualizerEnabled | Boolean |  | Gets or sets a flag indicating if the equalizer is enabled or not.
LastErrorNum | ErrorConstants |  | Read-only property that returns the number of the last error.
nSamplesCurrent | Long |  | Read-only property that returns the number of the current sample in audio data, which was sent to the output line by SendArray method.
nSamplesSend | Long |  | Read-only property that returns the total number of samples in audio data, which was sent to the output line by SendArray method.
srcAdvancedCount | Integer |  | Read-only property that returns the maximal number of advanced controls for the current output line. The current line must be set by srcOutput property preliminary.
srcAdvancedName | String (get), Integer (set) |  | Read-only property that returns the names of advanced controls for the current output line. The current line must be set by srcOutput property preliminary.
srcAdvancedValue | Variant (get), Integer (set) |  | Gets or sets the value for advanced controls for the current output line. The current line must be set by srcOutput property preliminary.
srcMute | Boolean |  | Gets or sets a flag indicating if the current line is mute or not. The current line must be set by srcOutput property preliminary.
srcMuteEnabled | Boolean |  | Read-only property that returns a flag indicating if srcMute property is enabled or not for the current line. The current line must be set by srcOutput property preliminary.
srcOutput | Integer |  | Gets or sets the current output line for the current output device. The current output device must be set by devOutput property preliminary.
srcOutputCount | Integer |  | Read-only property that returns the maximal number of the line for the current output device. The current output device must be set by devOutput property preliminary.
srcOutputName | String |  | Read-only property that returns the name of the current line for the current output device. The current output device must be set by devOutput property and the current line must be set by srcOutput property preliminary.
srcVolume | Long |  | Gets or sets the magnitude of the volume for playback of audio data for the current line. The current line must be set by srcOutput property preliminary.
srcVolumeBalance | Integer |  | Gets or sets the relative volume between the left and right channels in a stereo audio system for playback of audio data for the current line. The current line must be set by srcOutput property preliminary.
srcVolumeBalanceEnabled | Boolean |  | Read-only property that returns a flag indicating if srcVolumeBalance property is enabled or not.
srcVolumeEnabled | Boolean |  | Read-only property that returns a flag indicating if srcVolume property is enabled or not for the current line. The current line must be set by srcOutput property preliminary.
TimerEnabled | Boolean | True | Gets or sets a flag indicating if Timer event is generated or not.
TimerInterval | Integer | 100 | Gets or sets temporal interval (in ms) between Timer events.


ArrayChannels property (AudioPlayer2)

ArrayChannels property (AudioPlayer2 object)

Read-only property that returns the number of channels in the audio data. Monaural data uses one channel and stereo data uses two channels.

Property type

A ChannelsConstants value.

Syntax

object.ArrayChannels [= value]

The ArrayChannels property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
value | ChannelsConstants | The number of channels in the audio data.

Remarks:

You can set this property by SetFormatArray method.

Example:

' VB sample where Player is an AudioPlayer2 objects.
Dim Channels As ChannelsConstants
Channels = Player.ArrayChannels

See Also:

ArrayFrequency

Applies to: AudioPlayer2

Send Feedback on the NCTAudioPlayer2 documentation.
NCTAudioPlayer2 was developed by NCT company http://www.nctsoft.com


ArrayFrequency property (AudioPlayer2)

ArrayFrequency property (AudioPlayer2 object)

Read-only property that returns a frequency of the audio data.

Property type

A FrequencyConstants value.

Syntax

object.ArrayFrequency [= value]

The ArrayFrequency property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
value | FrequencyConstants | The frequency of the audio data.

Remarks:

You can set this property by SetFormatArray method.

Example:

' VB sample where Player is an AudioPlayer2 objects.
Dim Frequency As ChannelsConstants
Frequency = Player.ArrayFrequency

See Also:

ArrayChannels

Applies to: AudioPlayer2

Send Feedback on the NCTAudioPlayer2 documentation.
NCTAudioPlayer2 was developed by NCT company http://www.nctsoft.com


CurrentStereoChannel property (AudioPlayer2)

CurrentStereoChannel property (AudioPlayer2)

Gets or sets the current status of stereo.

Property type

A CurrentChannelsConstants value.

Syntax

object.CurrentStereoChannel [= value]

The CurrentStereoChannel property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
value | CurrentChannelsConstants | The number and type of channels.

See Also:

Applies to: AudioPlayer2


devOutput property (AudioPlayer2)

devOutput property (AudioPlayer2)

Gets or sets the number of the current output device.

Property type

An Integer value.

Syntax

object.devOutput [= value]

The devOutput property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
value | Integer | The current output device. Can accept values from 0 to devOutputCount.

Remarks:

You can get the name of the current output device using devOutputName property.

NCTAudioRecord2 and NCTAudioPlayer2 controls Windows Media Control. But the changes in Windows Media Control have an effect in an application that uses NCTAudioRecord2 (NCTAudioPlayer2). For example, the volume changes that are made using our controls have an effect on Windows Media Player and vice versa.

In the following picture is shown an analogue of our devOutput and srcOutput in Windows Media Control:

Example:

' VB sample where Player is an AudioPlayer2 object.
If Player.devOutputCount > 0 Then
    'if there are one or more devices (logical or physical) installed on the current machine
    kDevOutput = Player.devOutput
    'otherwise kDevOutput equals to the number of the output devices on the current machine
    For i = 0 To Player.devOutputCount
    'Start cycle which checks if the current device is able to play sound
        Player.devOutput = i
        'Sets number of the output device to "i"
        If Player.devSrcEnabled <> False Then
        'if this device is able to play sound
            DeviceCombo.AddItem Player.devOutputName
            'then adds this device to the list in DeviceCombo
            DeviceCombo.ItemData(DeviceCombo.NewIndex) = i
            'sets a specific number for each new device in a ComboBox control
        End If
    Next
End If

See Also:

devOutputCount | devOutputName


devOutputCount property (AudioPlayer2)

devOutputCount property (AudioPlayer2)

Read-only property that returns the maximal number of the output devices in your system.

Property type

An Integer value.

Syntax

value = object.devOutputCount

The devOutputCount property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
value | Integer |

Example:

' VB sample where Player is an AudioPlayer2 object.
If Player.devOutputCount > 0 Then
    'if there are one or more devices (logical or physical) installed on the current machine
    kDevOutput = Player.devOutput
    'otherwise kDevOutput equals to the number of the output devices on the current machine
    For i = 0 To Player.devOutputCount
    'Start cycle which checks if the current device is able to play sound
        Player.devOutput = i
        'Sets number of the output device to "i"
        If Player.devSrcEnabled <> False Then
        'if this device is able to play sound
            DeviceCombo.AddItem Player.devOutputName
            'then adds this device to the list in DeviceCombo
            DeviceCombo.ItemData(DeviceCombo.NewIndex) = i
            'sets a specific number for each new device in a ComboBox control
        End If
    Next
End If

See Also:

devOutput | devOutputName


devOutputName property (AudioPlayer2)

devOutputName property (AudioPlayer2)

Read-only property that returns the name of the current output device. The current output device must be set by devOutput property preliminary.

Property type

A String value.

Syntax

value = object.devOutputName

The devOutputName property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
value | String | The current output device.

Example:

' VB sample where Player is an AudioPlayer2 object.
If Player.devOutputCount > 0 Then
    'if there are one or more devices (logical or physical) installed on the current machine
    kDevOutput = Player.devOutput
    'otherwise kDevOutput equals to the number of the output devices on the current machine
    For i = 0 To Player.devOutputCount
    'Start cycle which checks if the current device is able to play sound
        Player.devOutput = i
        'Sets number of the output device to "i"
        If Player.devSrcEnabled <> False Then
        'if this device is able to play sound
            DeviceCombo.AddItem Player.devOutputName
            'then adds this device to the list in DeviceCombo
            DeviceCombo.ItemData(DeviceCombo.NewIndex) = i
            'sets a specific number for each new device in a ComboBox control
        End If
    Next
End If

See Also:

devOutput | devOutputCount


devSrcEnabled property (AudioPlayer2)

devSrcEnabled property (AudioPlayer2)

Read-only property that returns a flag indicating if the current output device can be used for playback of audio data. The current output device must be set by devOutput property preliminary.

Property type

A Boolean value.

Syntax

value = object.devSrcEnabled

The devSrcEnabled property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
value | Boolean | True if current output line can be used for playback, otherwise - False.

Example:

' VB sample where Player is an AudioPlayer2 object.
If Player.devOutputCount > 0 Then
    'if there are one or more devices (logical or physical) installed on the current machine
    kDevOutput = Player.devOutput
    'otherwise kDevOutput equals to the number of the output devices on the current machine
    For i = 0 To Player.devOutputCount
    'Start cycle which checks if the current device is able to play sound
        Player.devOutput = i
        'Sets number of the output device to "i"
        If Player.devSrcEnabled <> False Then
        'if this device is able to play sound
            DeviceCombo.AddItem Player.devOutputName
            'then adds this device to the list in DeviceCombo
            DeviceCombo.ItemData(DeviceCombo.NewIndex) = i
            'sets a specific number for each new device in a ComboBox control
        End If
    Next
End If


devVolume property (AudioPlayer2)

devVolume property (AudioPlayer2)

Gets or sets Volume for the current output device. The current output device must be set by devOutput property preliminary.

Property type

A Long value.

Syntax

object.devVolume [= value]

The devVolume property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
value | Long | Can accept values from 0 to 65535.


EqualizerEnabled property (AudioPlayer2)

EqualizerEnabled property (AudioPlayer2)

Gets or sets a flag indicating if the equalizer is enabled or not.

Property type

A Boolean value.

Syntax

object.EqualizerEnabled [= value]

The EqualizerEnabled property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
value | Boolean | True if equalizer is enabled, otherwise - False.


LastErrorNum property (AudioPlayer2)

LastErrorNum property (AudioPlayer2)

Read-only property that returns the number of the last error.

Property type

A ErrorConstants value.

Syntax

value = object.LastErrorNum

The LastErrorNum property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
value | ErrorConstants | Error code.

Remarks:

At present you can use two ways for an errors catch: using the standard error processor from VB or using the LastErrorNum property.

Example:

This is an example of using of the standard error processor from VB:

Private Sub LoadPlayBuffer()
On Error GoTo Err_LoadPlayBuffer
    Dim Wav() As Integer
    If flgPlay = False Then Exit Sub
    Wav() = AudioFile.ReadFile(BufferSize)
    If UBound(Wav) > 0 Then
        AudioPlayer.SendArray Wav()
    End If

Exit_LoadPlayBuffer:
    Exit Sub
Err_LoadPlayBuffer:
    MsgBox Err.Description
    Resume Exit_LoadPlayBuffer
End Sub

This is an example of using of the LastErrorNum property:

Private Sub LoadPlayBuffer()
    Dim Wav() As Integer
    If flgPlay = False Then Exit Sub
    Wav() = AudioFile.ReadFile(BufferSize)
    If AudioFile.LastErrorNum < 0 Then GoTo Err_LoadPlayBuffer
    If UBound(Wav) > 0 Then
        AudioPlayer.SendArray Wav()
        If AudioPlayer.LastErrorNum < 0 Then GoTo Err_LoadPlayBuffer
    End If

Exit_LoadPlayBuffer:
    Exit Sub
Err_LoadPlayBuffer:
    MsgBox Err.Description
    Resume Exit_LoadPlayBuffer
End Sub


nSamplesCurrent property (AudioPlayer2)

nSamplesCurrent property (AudioPlayer2)

Read-only property that returns the number of the current sample in audio data, which was sent to the output line by SendArray method.

Property type

A Long value.

Syntax

value = object.nSamplesCurrent

The nSamplesCurrent property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
value | Long | Cannot exceed the value of nSamplesSend property.

Remarks:

This property is set to zero after applying RestartDevice method.

See Also:

nSamplesSend


nSamplesSend property (AudioPlayer2)

nSamplesSend property (AudioPlayer2)

Read-only property that returns the total number of samples in audio data, which was sent to the output line by SendArray method.

Property type

A Long value.

Syntax

value = object.nSamplesSend

The nSamplesSend property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
value | Long | The number of samples in audio data.

Remarks:

This property is set to zero after applying RestartDevice method.

See Also:

nSamplesCurrent


srcAdvancedCount property (AudioPlayer2)

srcAdvancedCount property (AudioPlayer2)

Read-only property that returns the maximal number of advanced controls for the current output line. The current line must be set by srcOutput property preliminary.

Property type

An Integer value.

Syntax

value = object.srcAdvancedCount

The srcAdvancedCount property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
value | Integer |

Example:

' VB sample where Player is an AudioPlayer2 object.
Dim i                   'Declares the counter variable
Me.Caption = Player.srcOutputName & ": Advanced Properties"
'generating the title of the frame 'been called
For i = 0 To Player.srcAdvancedCount        'starts the cycle
    Combo1.AddItem Player.srcAdvancedName(i)
    'that forms the Combo list
Next i

See Also:

srcAdvancedName | srcAdvancedValue


srcAdvancedName property (AudioPlayer2)

srcAdvancedName property (AudioPlayer2)

Read-only property that returns the names of advanced controls for the current output line. The current line must be set by srcOutput property preliminary.

Property type

A String value.

Syntax

valueo = bject.srcAdvancedName(Index As Integer)

The srcAdvancedName property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
index | Integer | Index can accept values from 0 to scrAdvancedCount.
value | String | Names of advanced controls.

Example:

' VB sample where Player is an AudioPlayer2 object.
Dim i                   'Declares the counter variable
Me.Caption = Player.srcOutputName & ": Advanced Properties"
'generating the title of the frame 'been called
For i = 0 To Player.srcAdvancedCount        'starts the cycle
    Combo1.AddItem Player.srcAdvancedName(i)
    'that forms the Combo list
Next i

See Also:

srcAdvancedCount | srcAdvancedValue


srcAdvancedValue property (AudioPlayer2)

srcAdvancedValue property (AudioPlayer2)

Gets or sets the value for advanced controls for the current output line. The current line must be set by srcOutput property preliminary.

Property type

A Variant value.

Syntax

[value = ]object.srcAdvancedValue(Index As Integer)

The srcAdvancedValue property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
Index | Integer | Index can accept values from 0 to scrAdvancedCount.
value | Variant |

See Also:

srcAdvancedCount | srcAdvancedName


srcMute property (AudioPlayer2)

srcMute property (AudioPlayer2)

Gets or sets a flag indicating if the current line is mute or not. The current line must be set by srcOutput property preliminary.

Property type

A Boolean value.

Syntax

object.srcMute [= value]

The srcMute property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
value | Boolean | True if the current line is mute, otherwise - False.

Remarks:

This property is enabled only if srcMuteEnabled property is set to True.

See Also:

srcMuteEnabled


srcMuteEnabled property (AudioPlayer2)

srcMuteEnabled property (AudioPlayer2)

Read-only property that returns a flag indicating if srcMute property is enabled or not for the current line. The current line must be set by srcOutput property preliminary.

Property type

A Boolean value.

Syntax

value = object.srcMuteEnabled

The srcMuteEnabled property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
value | Boolean | True if srcMute is enabled, otherwise - False.

See Also:

srcMute


srcOutput property (AudioPlayer2)

srcOutput property (AudioPlayer2)

Gets or sets the current output line for the current output device. The current output device must be set by devOutput property preliminary.

Property type

An Integer value.

Syntax

object.srcOutput [= value]

The srcOutput property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
value | Integer | Can accept values from 0 to srcOutputCount.

Remarks:

NCTAudioRecord2 and NCTAudioPlayer2 controls Windows Media Control. But the changes in Windows Media Control have an effect in an application that uses NCTAudioRecord2 (NCTAudioPlayer2). For example, the volume changes that are made using our controls have an effect on Windows Media Player and vice versa.

In the following picture is shown an analogue of our devOutput and srcOutput in Windows Media Control:

Example:

' VB sample where Player is an AudioPlayer2 object.
Player.srcOutput = Player.srcOutputCount
Player.srcVolume = 1020
Player.SetFormatArray FQ_44_KHZ, STEREO
Player.BufferSize = Player.SecToSamples(1000)
Player.StartDevice
...
Player.StopDevice

See Also:

srcOutputCount | srcOutputName


srcOutputCount property (AudioPlayer2)

srcOutputCount property (AudioPlayer2)

Read-only property that returns the maximal number of the line for the current output device. The current output device must be set by devOutput property preliminary.

Property type

An Integer value.

Syntax

value = object.srcOutputCount

The srcOutputCount property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
value | Integer | The maximal number of the line.

Example:

' VB sample where Player is an AudioPlayer2 object.
Player.srcOutput = Player.srcOutputCount
Player.srcVolume = 1020
Player.SetFormatArray FQ_44_KHZ, STEREO
Player.BufferSize = Player.SecToSamples(1000)
Player.StartDevice
...
Player.StopDevice

See Also:

srcOutput | srcOutputName


srcOutputName property (AudioPlayer2)

srcOutputName property (AudioPlayer2)

Read-only property that returns the name of the current line for the current output device. The current output device must be set by devOutput property and the current line must be set by srcOutput property preliminary.

Property type

A String value.

Syntax

value = object.srcOutputName

The srcOutputName property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
value | String |

Example:

' VB sample where Player is an AudioPlayer2 object.
Dim i                   'Declares the counter variable
Me.Caption = Player.srcOutputName & ": Advanced Properties"
'generating the title of the frame 'been called
For i = 0 To Player.srcAdvancedCount        'starts the cycle
    Combo1.AddItem Player.srcAdvancedName(i)
    'that forms the Combo list
Next i

See Also:

srcOutput | srcOutputCount


srcVolume property (AudioPlayer2)

srcVolume property (AudioPlayer2)

Gets or sets the magnitude of the volume for playback of audio data for the current line. The current line must be set by srcOutput property preliminary.

Property type

A Long value.

Syntax

object.srcVolume [= value]

The srcVolume property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
value | Long | Can accept values from 0 to 65535.

Example:

' VB sample where Player is an AudioPlayer2 object.
Player.srcOutput = Player.srcOutputCount
Player.srcVolume = 1020
Player.SetFormatArray FQ_44_KHZ, STEREO
Player.BufferSize = Player.SecToSamples(1000)
Player.StartDevice
...
Player.StopDevice

See Also:

srcVolumeEnabled


srcVolumeBalance property (AudioPlayer2)

srcVolumeBalance property (AudioPlayer2)

Gets or sets the relative volume between the left and right channels in a stereo audio system for playback of audio data for the current line. The current line must be set by srcOutput property preliminary.

Property type

An Integer value.

Syntax

object.srcVolumeBalance [= value]

The srcVolumeBalance property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
value | Integer | Can accept values from 0 to 100. When value = 50, equal distribution is given to the left and right channels. If value < 50 the volume of the right channel is lower than that of the left channel, and vice versa.

See Also:

srcVolumeBalanceEnabled


srcVolumeBalanceEnabled property (AudioPlayer2)

srcVolumeBalanceEnabled property (AudioPlayer2)

Read-only property that returns a flag indicating if srcVolumeBalance property is enabled or not.

Property type

A Boolean value.

Syntax

value = object.srcVolumeBalanceEnabled

The srcVolumeBalanceEnabled property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
value | Boolean | True if srcVolumeBalance is enabled, otherwise - False.

See Also:

srcVolumeBalance


srcVolumeEnabled property (AudioPlayer2)

srcVolumeEnabled property (AudioPlayer2)

Read-only property that returns a flag indicating if srcVolume property is enabled or not for the current line. The current line must be set by srcOutput property preliminary.

Property type

A Boolean value.

Syntax

value = object.srcVolumeEnabled

The srcVolumeEnabled property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
value | Boolean | True if srcVolume is enabled, otherwise - False.

See Also:

srcVolume


TimerEnabled property (AudioPlayer2)

TimerEnabled property (AudioPlayer2)

Gets or sets a flag indicating if Timer event is generated or not.

Property type

A Boolean value.

Syntax

object.TimerEnabled [= value]

The TimerEnabled property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
value | Boolean | True if Timer event is generated, otherwise - False. By default value is set to True.

See Also:

TimerInterval


TimerInterval property (AudioPlayer2)

TimerInterval property (AudioPlayer2)

Gets or sets temporal interval (in ms) between Timer events.

Property type

An Integer value.

Syntax

object.TimerInterval [= value]

The TimerInterval property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
value | Integer | By default is set to 100.

See Also:

TimerEnabled


AudioPlayer2 methods

AudioPlayer2 methods

Method | Description
GetCurrentArray | Gets the currently playing audio data array.
Register | Enters user name and registration password to disable About window.
RestartDevice | Restarts output line for the current output device.
SamplesToSec | Converts the number of samples to milliseconds.
SecToSamples | Converts milliseconds to samples.
SendArray | Sends audio data as array to the current line of the output device for playback. The The current output device must be set by devOutput property and the current output line must be set by srcOutput property preliminary.
SetEqualizerArray | Sets equalizer array.
SetFormatArray | Sets the format of audio data for playback.
StartDevice | Opens the current output line for the current output device for playback. The current output device must be set by devOutput property and the current output line must be set by srcOutput property preliminary.
StopDevice | Closes the output device and stops playback.


GetCurrentArray method

GetCurrentArray method

Gets the currently playing audio data array.

Return Type

An Integer() value.

Syntax

AudioArray = object.GetCurrentArray(nSamples As Long)

The GetCurrentArray method syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
nSamples | Long | Number of samples.
AudioArray | Integer() | Audio data array.

Remarks:

This method can be used for real-time visualization of signal or its spectrum.


Register method

Register method

Enters user name and registration password to disable About window.

Syntax

object.Register(bstrUser As String, bstrPassword As String)

The Register method syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object of type .
bstrUser | String | User name. You get a registration user name after the registration.
bstrPassword | String | Password string. You get a registration password after the registration.

Example:

' VB sample where Player is an AudioPlayer2 object.
Player.Register "XXX", "XXX"


RestartDevice method

RestartDevice method

Restarts output line for the current output device.

Syntax

object.RestartDevice()

The RestartDevice method syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.

Remarks:

This method can be applied only after StartDevice method.

This method deletes all data sending it to the output line by SendArray method from device buffer. For instance, this method can be applied to change playback position.

After applying this method nSamplesSend and nSamplesCurrent properties are set to zero.

Example:

' VB sample where Player is an AudioPlayer2 object.
Player.srcOutput = Player.srcOutputCount
Player.srcVolume = 1020
Player.SetFormatArray FQ_44_KHZ, STEREO
Player.BufferSize = Player.SecToSamples(1000)
Player.StartDevice
...
Player.RestartDevice
...
Player.StopDevice

See Also:

StartDevice | StopDevice


SamplesToSec method

SamplesToSec method

Converts the number of samples to milliseconds.

Return Type

A Long value.

Syntax

Millisec = object.SamplesToSec(Samples As Long)

The SamplesToSec method syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
Samples | Long | Number of samples.
Millisec | Long | Number of milliseconds.

Remarks:

You should apply SetFormatArray method before using this method.

See Also:

SecToSamples


SecToSamples method

SecToSamples method

Converts milliseconds to samples.

Return Type

A Long value.

Syntax

Samples = object.SecToSamples(Millisec As Long)

The SecToSamples method syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
Millisec | Long | Number of milliseconds.
Samples | Long | Number of samples.

Remarks:

You should apply SetFormatArray method before using this method.

See Also:

SamplesToSec


SendArray method

SendArray method

Sends audio data as array to the current line of the output device for playback. The current output device must be set by devOutput property and the current output line must be set by srcOutput property preliminary.

Syntax

object.SendArray(WavArray As Integer())

The SendArray method syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
WavArray | Integer() | Audio array, sending to the output device.

Remarks:

This method can be applied only after StartDevice method.

Example:

' VB sample where Player is an AudioPlayer2 object and AudioFile2 is an AudioFile2 object.
Private Sub Player_EndArrayPlay(ByVal nBlock As Long)
    Dim Wav() As Integer    'Declares the array of data to playback
    If flgPlay = False Then Exit Sub
    'if nothing is played then exit sub
    Wav() = AudioFile1.ReadFile(BufferSize)
    'reads a block of buffer size from an input file to Wav() array
    If UBound(Wav) > 0 Then 'if this data array contains anything
        AudioPlayer1.SendArray Wav()
        'then send it to the output device
    End If
End Sub


SetEqualizerArray method

SetEqualizerArray method

Sets equalizer array.

Syntax

object.SetEqualizerArray(dbGainArray As Single())

The SetEqualizerArray method syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
dbGainArray | Single() | Gain array in db. All values vary from -92 to 92.

Remarks:

This method can be applied only if EqualizerEnabled property is set to True.


SetFormatArray method

SetFormatArray method

Sets the format of audio data for playback.

Syntax

object.SetFormatArray(Frequency As FrequencyConstants, nChannels As ChannelsConstants)

The SetFormatArray method syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
Frequency | FrequencyConstants | Frequency of an audio file. By default Frequency is equal to FQ_44_KHZ.
nChannels | ChannelsConstants | Number of channels of an audio file. By default nChannels is equal to STEREO.

Remarks:

This method can be applied before StartDevice method.


StartDevice method

StartDevice method

Opens the current output line for the current output device for playback. The current output device must be set by devOutput property and the current output line must be set by srcOutput property preliminary.

Syntax

object.StartDevice

The StartDevice method syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.

Remarks:

Before applying this method you should set format by SetFormatArray method.

Output device can be closed by StopDevice method.

Example:

' VB sample where Player is an AudioPlayer2 object.
Player.srcOutput = Player.srcOutputCount
Player.srcVolume = 1020
Player.SetFormatArray FQ_44_KHZ, STEREO
Player.BufferSize = Player.SecToSamples(1000)
Player.StartDevice
...
Player.StopDevice

See Also:

RestartDevice | StopDevice


StopDevice method

StopDevice method

Closes the output device and stops playback.

Syntax

object.StopDevice

The StopDevice method syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.

Remarks:

This method can be applied only after StartDevice method.

Example:

' VB sample where Player is an AudioPlayer2 object.
Player.srcOutput = Player.srcOutputCount
Player.srcVolume = 1020
Player.SetFormatArray FQ_44_KHZ, STEREO
Player.BufferSize = Player.SecToSamples(1000)
Player.StartDevice
...
Player.StopDevice

See Also:

RestartDevice | StartDevice


AudioPlayer2 events

AudioPlayer2 events

Event | Description
EndArrayPlay | Occurs when the current block sent by SendArray method is completed in playback process.
EndPlay | Occurs when the buffer for playback is empty.
RequestOnLoadArray | Occurs when audio data in the buffer is less than for 1 sec playback.
Timer | Occurs in accordance with TimerInterval property if TimerEnabled property is set to True .


EndArrayPlay event

EndArrayPlay event

Occurs when the current block sent by SendArray method is completed in playback process.

Syntax

Sub object_EndArrayPlay()

Remarks:

When this event occurs nSamplesCurrent becomes equal to nSamplesSend.

Example:

' VB sample where Player is an AudioPlayer2 object and AudioFile2 is an AudioFile2 object.
Private Sub Player_EndArrayPlay(ByVal nBlock As Long)
    Dim Wav() As Integer    'Declares the array of data to playback
    If flgPlay = False Then Exit Sub
    'if nothing is played then exit sub
    Wav() = AudioFile1.ReadFile(BufferSize)
    'reads a block of buffer size from an input file to Wav() array
    If UBound(Wav) > 0 Then 'if this data array contains anything
        AudioPlayer1.SendArray Wav()
        'then send it to the output device
    End If
End Sub

See Also:

EndPlay


EndPlay event

EndPlay event

Occurs when the buffer for playback is empty.

Syntax

Sub object_EndPlay()

Remarks:

When this event occurs nSamplesCurrent becomes equal to nSamplesSend.

See Also:

EndArrayPlay


RequestOnLoadArray event

RequestOnLoadArray event

Occurs when audio data in the buffer is less than for 1 sec playback.

Syntax

Sub object_RequestOnLoadArray()


Timer event

Timer event

Occurs in accordance with TimerInterval property if TimerEnabled property is set to True .

Syntax

Sub object_Timer(CurrentSamples As Long, LevelLeft As Long, LevelRight As Long)

The Timer event syntax has these named arguments:

Part | Type | Description
CurrentSamples | Long | Current playback position.
LevelLeft | Long | Current playback level of the left channel.
LevelRight | Long | Current playback level of the right channel.


NCTAudioPlayer2 constants

NCTAudioPlayer2 constants

Constants | Description
ChannelsConstants | These are the constants for the following property and method: ArrayChannels property (AudioPlayer2), SetFormatArray method.
CurrentChannelsConstants | These are the constants for the CurrentStereoChannel property (AudioPlayer2).
ErrorConstants | These are the constants for the LastErrorNum property.
FrequencyConstants | These are the constants for the following property and method: ArrayFrequency property (AudioPlayer2), SetFormatArray method.
TypeLevelConstants | These are the constants for the TypeLevel property (AudioPlayer2).


ChannelsConstants enumeration

ChannelsConstants enumeration

These are the constants for the following property and method: ArrayChannels property (AudioPlayer2), SetFormatArray method.

Members

Constant | Value | Description
MONO | 1 | Audio data is mono.
STEREO | 2 | Audio data is stereo.


CurrentChannelsConstants enumeration

CurrentChannelsConstants enumeration

These are the constants for the CurrentStereoChannel property (AudioPlayer2).

Members

Constant | Value
LEFT_CHANNEL | 1
RIGHT_CHANNEL | 2
BOTH_CHANNELS | 3


ErrorConstants enumeration

ErrorConstants enumeration

These are the constants for the LastErrorNum property.

Members

Part | Value | Description
NOERRORS | 0 | No errors.
BUSY | -10 | It is impossible to execute the current method because the application is busy by another one.
MEMORY | -11 | Memory error.
FORMATFILE | -12 | Wrong file format. It is an attempt to open a non-audio file as an audio file.
FORMATNOTSUPPORT | -13 | Unsupported audio file format. It is an attempt to open an unsupported audio file format.
OUTDRIVER | -14 | Output audio device error. For example: wrong device, audio device is already opened in your application or is in use by another one and many others… It hardly depends on hardware.
INPDRIVER | -15 | Input audio device error. . For example: wrong device, audio device is already opened in your application or is in use by another one and many others… It hardly depends on hardware.
MIXERDRIVER | -16 | Mixer device driver error.
ACMDRIVER | -17 | ACM driver error.
FILEACCESS | -18 | The specified file is already in use.
INVALIDOPERATION | -19 | Invalid operation. For example, you try to execute READ method before OPEN method.
INVALIDPARAM | -20 | Invalid parameters. You try to execute a method with invalid parameters.
ASPIDRIVER | -21 | Incorrect CD driver operation. ASPI driver returns an error.
CONTROLNOTINSTALLED | -22 | Control not installed.
INDEXOUTOFRANGE | -23 | Incorrect address to the array. Index out of the array range.
STREAM | -24 |
UNEXPECTED | -40 | Unexpected error.


FrequencyConstants enumeration

FrequencyConstants enumeration

These are the constants for the following property and method: ArrayFrequency property (AudioPlayer2), SetFormatArray method.

Members

Constant | Value | Description
FQ_96_KHZ | 96000 | 96000 hertz.
FQ_88_KHZ | 88200 | 88200 hertz.
FQ_48_KHZ | 48000 | 48000 hertz.
FQ_44_KHZ | 44100 | 44100 hertz.
FQ_32_KHZ | 32000 | 32000 hertz.
FQ_24_KHZ | 24000 | 24000 hertz.
FQ_22_KHZ | 22050 | 22050 hertz.
FQ_16_KHZ | 16000 | 16000 hertz.
FQ_12_KHZ | 12000 | 12000 hertz.
FQ_11_KHZ | 11025 | 11025 hertz.
FQ_8_KHZ | 8000 | 8000 hertz.
FQ_6_KHZ | 6000 | 6000 hertz.


AudioPlayer2

NCTAudioStudio2 ActiveX DLLs

Version 2.2

NCTAudioPlayer2 ActiveX DLL is intended for playback audio data.

With NCTAudioPlayer2 ActiveX DLL you can:

  • Playback of audio data.

  • Set devices of playback.

  • Change Volume of playback.

  • Get information about playback in real time.

NCTAudioPlayer2 is a part of the NCTAudioStudio2 package.


TypeLevel property (AudioPlayer2)

TypeLevel property (AudioPlayer2)

Gets or sets the type of the level, fired by Timer event.

Property type

A TypeLevelConstants value.

Syntax

object.TypeLevel [= value]

The TypeLevel property syntax has these parts:

Part | Type | Description
object | AudioPlayer2 | An expression evaluating to an object.
value | TypeLevelConstants | The type of level.


NCTAUDIOPLAYER2Lib

NCTAudioCompress ActiveX DLL
Version

NCTAudioCompress ActiveX DLL

Version

NCTAudioPlayer 2.2 Type Library

The NCTAudioCompress consists of the following objects:

Objects
AudioPlayer2

You can use the NCTAudioCompress in your program, written on the language, which supports ActiveX automation.

The NCTAudioCompress was tested with:

  • MS Visual Basic 6.0 (SP5);

  • MS Visual C++ 6.0 (SP5);

  • Borland C++ Builder 5.0;

  • Borland Delphi 6.0.

under Windows 98/Me/NT/2000/XP

SYSTEM REQUIREMENTS:

  • Windows 98/Me/NT/2000/XP;

  • MS Visual Basic 6.0 or MS VC++ 6.0 (SP5).

Send Feedback on the NCTAudioCompress documentation.
NCTAudioCompress was developed by NCT company http://www.nctsoft.com


TypeLevelConstants enumeration

TypeLevelConstants enumeration

These are the constants for the TypeLevel property (AudioPlayer2).

Members

Constant | Value | Description
AVERAGE | 1 | Level is calculated in normalized values as average value.
PEAK | 2 | Level is calculated in normalized values as peak value.
AVERAGE_DB | 3 | Level is calculated in db as average value.
PEAK_DB | 4 | Level is calculated in db as peak value.